from sqlmodel import SQLModel, Field, Column, Integer, String, Boolean
import typing as T


class UserChatHistory(SQLModel, table=True):
    """
    用户与ai对话的历史记录的表实体
    """

    __tablename__ = "user_chat_history"
    id: int = Field(default=None, primary_key=True)
    content: str = Field(
        sa_column=Column("content", String, nullable=False),
        description="用户会话窗口的内容",
    )
    isAi: bool = Field(
        sa_column=Column("is_ai", Boolean, nullable=False), description="是否是AI的回复"
    )
    sessionId: int = Field(
        sa_column=Column("session_id", Integer, nullable=False),
        description="用户会话窗口的id",
    )
